// ----------------------------------------------------------------------------------
// Microsoft Developer & Platform Evangelism
// 
// Copyright (c) Microsoft Corporation. All rights reserved.
// 
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
// ----------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
// ----------------------------------------------------------------------------------

namespace STSFederationMetadataEditor
{
    using System.Configuration;

    public class ClaimConfigElement : ConfigurationElement
    {
        public ClaimConfigElement(string newType, string newDisplayName, string newValue)
        {
            this.Type = newType;
            this.DisplayName = newDisplayName;
            this.Value = newValue;
        }

        // Default constructor, will use default values as defined
        // below.
        public ClaimConfigElement()
        {
        }

        // Constructor allowing name to be specified, will take the
        // default values for url and port.
        public ClaimConfigElement(string elementName)
        {
            this.Type = elementName;
        }

        [ConfigurationProperty("type", IsRequired = true, IsKey = true)]
        public string Type
        {
            get
            {
                return (string)this["type"];
            }

            set
            {
                this["type"] = value;
            }
        }

        [ConfigurationProperty("displayname", IsRequired = true)]
        public string DisplayName
        {
            get
            {
                return (string)this["displayname"];
            }

            set
            {
                this["displayname"] = value;
            }
        }

        [ConfigurationProperty("value", IsRequired = false)]
        public string Value
        {
            get
            {
                return (string)this["value"];
            }

            set
            {
                this["value"] = value;
            }
        }

        protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey)
        {
            base.DeserializeElement(reader, serializeCollectionKey);

            // You can your custom processing code here.
        }

        protected override bool SerializeElement(System.Xml.XmlWriter writer, bool serializeCollectionKey)
        {
            bool ret = base.SerializeElement(writer, serializeCollectionKey);

            // You can enter your custom processing code here.
            return ret;
        }

        protected override bool IsModified()
        {
            bool ret = base.IsModified();

            // You can enter your custom processing code here.
            return ret;
        }
    }
}